var container = document.createElement('div');

var button = document.createElement('input');
button.appendChild(document.createTextNode('Butt!'));
button.value="value";
button.addEventListener('click', function(){alert ('test')});

var body = document.getElementsByTagName('body')[0];


container.appendChild(button);
body.appendChild(container);
